#!/bin/sh
dt=`date +%Y-%m-%d`
num=`$HIVE_HOME/bin/hive -e "set hive.cli.print.header=false;select count(1) from (select row_number() over(partition by id) rnk from mydb.user_clicks where dt='${dt}') tmp where rnk < 2;"`
$HIVE_HOME/bin/hive -e "insert into table mydb.user_info values('${num}','${dt}')"
echo "over";
